import { getInquiriesLists, getInquiriesDetailInfo } from '../../fetch/modules/inquiries'

const state = {
    inquiriesLists: {
    },
    inquiriesDetailInfo:{}
}

const actions = {
    GET_INQUIRIES_LISTS: ({ commit, state }, opts) => {
        return getInquiriesLists(opts).then(inquiries => commit('FETCH_INQUIRIES_LISTS', { inquiries }))
    },
    FETCH_INQUIRIES_DETAIL: ({ commit, state }, opts) => {
        return getInquiriesDetailInfo(opts).then(inquiries => commit('GET_INQUINIERS_DETAIL_INFO', { inquiries }))
    },
}
const mutations = {
    FETCH_INQUIRIES_LISTS: (state, { inquiries }) => {
        state.inquiriesLists = inquiries.data;
    },
    GET_INQUINIERS_DETAIL_INFO: (state, { inquiries }) => {
        state.inquiriesDetailInfo = inquiries.data;
    },
}

const getters = {
    getInquiriesLists (state) {
        return state.inquiriesLists
    },
    getInquiriesDetailInfo (state) {
        return state.inquiriesDetailInfo
    },
}

export default {
    state,
    actions,
    mutations,
    getters
}